{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "23d710b3-dd78-4f76-895f-7e22f194d738",
   "metadata": {},
   "source": [
    "### Try this notebook in Google Colab, Binder or SageMaker!\n",
    "\n",
    "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/InsightSoftwareConsortium/itkwidgets/blob/main/examples/Hello3DWorld.ipynb)\n",
    "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/InsightSoftwareConsortium/itkwidgets/HEAD?labpath=examples%2FHello3DWorld.ipynb)\n",
    "[![Open In SageMaker Studio Lab](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github.com/InsightSoftwareConsortium/itkwidgets/blob/main/examples/Hello3DWorld.ipynb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "3b12a0d4",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "\n",
    "!{sys.executable} -m pip install -q imageio \"itkwidgets[all]>=1.0a23\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c3c5eb6e",
   "metadata": {},
   "outputs": [],
   "source": [
    "from itkwidgets import view\n",
    "\n",
    "try:\n",
    "    import imageio.v2 as imageio\n",
    "except ImportError:\n",
    "    # Colab\n",
    "    import imageio"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "1bc45207",
   "metadata": {},
   "outputs": [],
   "source": [
    "stent = imageio.imread('imageio:stent.npz')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "26582452",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "                <img id=\"screenshot_imjoy_window_6aaab6ab-31ce-402a-b47c-fc2f6193d53e\" src=>\n",
       "                <script type=\"text/javascript\">\n",
       "                    var image = document.getElementById(\"screenshot_imjoy_window_6aaab6ab-31ce-402a-b47c-fc2f6193d53e\");\n",
       "                    image.src = \"\";\n",
       "                    var viewer = document.getElementById(\"imjoy_window_6aaab6ab-31ce-402a-b47c-fc2f6193d53e\");\n",
       "                    // Hide the static image if the Viewer is visible\n",
       "                    image.style.display = viewer ? \"none\" : \"block\";\n",
       "                </script>\n",
       "            "
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "window.connectPlugin && window.connectPlugin(\"22a08c0c-2bb4-4cc9-977c-735cbff2c59d\")"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div id=\"7ed3d089-b6fe-4409-8e68-30c13b447301\"></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<itkwidgets.viewer.Viewer at 0x7f21b0d7c690>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "viewer = view(stent, rotate=True)\n",
    "viewer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4e0450d4",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
